#include "../KmyAlgorithm.h"

#include "KmyVar.h"
#include "KmyVarInt.h"
#include "KmyVarFloat.h"
#include "KmyVarString.h"

KmyVar::KmyVar()
{
}

KmyVar::~KmyVar(){

}

KmyVar* KmyVar::createVar(const string &str){
    int strtype = getStringType(str);
    switch (strtype){
    case 0:
    {
        KmyVarString *kvs = new KmyVarString(str);
        return (KmyVar*)kvs;
    }
    case 1:
    {
        KmyVarInt *kvi = new KmyVarInt(stringToInt(str));
        return (KmyVar*)kvi;
    }
    case 2:
    {
        KmyVarFloat *kvf = new KmyVarFloat(stringToFloat(str));
        return (KmyVar*)kvf;
    }
    }

    return NULL;
}
